﻿Option Explicit On
'Option Strict On

''Hacer objeto cobrar



''' <summary>
''' Clase para calcular las facturas,cobrar e imprimirlas.
''' </summary>
''' <autor_modificacion>AitorSalgado</autor_modificacion>
''' <fecha_Modificado>24/01/2012</fecha_Modificado>
''' <modificaciones>
''' 1.0 - Creada la clase
''' 2.0 - Añadidos métodos necesarios para operar con la BBDD.
''' 
''' </modificaciones>
''' <fecha_creación>24/01/2012</fecha_creación>
''' <author>Aitor Salgado Molina</author>

Public Class Cobrar

    Private _objetoCobrar As New ObjCobrar

#Region "Private"
    Private Sub Cobrar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        _objetoCobrar.CargarCombobox()

    End Sub

#Region "eventos picture box"
    Private Sub PictureBoxCobrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBoxCobrar.Click
        'Llamar función de cobrar
        _objetoCobrar.CobrarCita()
    End Sub

    Private Sub PictureBoxCobrar_Hover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBoxCobrar.MouseHover
        'Llamar función de cobrar
        PictureBoxCobrar.BackgroundImage = Image.FromFile("Img/Botones/BCobrarCon.png")
    End Sub

    Private Sub PictureBoxCobrar_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBoxCobrar.MouseLeave
        'Llamar función de cobrar
        PictureBoxCobrar.BackgroundImage = Image.FromFile("Img/Botones/BCobrarSin.png")
    End Sub
#End Region

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        _objetoCobrar.LimpiarDatos()
        Me._dgvTratamientos.Rows.Clear()
        _objetoCobrar.CargarDatagrid(CInt(ComboBox2.SelectedIndex))
        _tbTotal.Text = _objetoCobrar.CalcularTotal()
    End Sub

    Private Sub _dgvTratamientos_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles _dgvTratamientos.CellEndEdit
        _tbTotal.Text = _objetoCobrar.RecalcularTotal()
    End Sub

#End Region
    
    
End Class